#include <generik/tracing.h>
GENERIK_TRACER_GLOBAL

#include <generik/exceptions.h>
#include <unistd.h>

struct constructdestruct
{
	constructdestruct()
	{
		GENERIK_TRACER;
	}
	~constructdestruct()
	{
		GENERIK_TRACER;
	}
};

void shouldnotbetraced()
{
	REM_GENERIK_TRACER;
}

void takestime()
{
	GENERIK_TRACER;
	GENERIK_TRACE("this should take a while...");
	//sleep(1);
	double j = 0;
	for (int i = 0; i < 10000; ++i)
	{
		for (int i = 0; i < 5000; ++i)
		{
			j = rand();
		}
	}
}

void inlineonly()
{
	GENERIK_INLINE("this should appear in main!");
}

int main()
{
	GENERIK_TRACER;
	
	GENERIK_TRACE("hello world!");
	
	constructdestruct cd;
	
	GENERIK_ASSERT(1 == 1);
	
	try
	{
		GENERIK_ASSERT(1 == 0);
	}
	catch(generik::failed_assertion& f)
	{
		GENERIK_TRACE(f.what());
	}
	
	shouldnotbetraced();
	takestime();
	inlineonly();
	
	GENERIK_ERROR("THIS IS AN ERROR!");
	
	return 0;
}


